
#pragma once

class AbstractGlutWindow;

class GlutApplication
{
friend void GDisplayFunc();
friend void GReshapeFunc(int, int);
friend void GVisibilityFunc(int);
friend void GKeyboardFunc(unsigned char, int, int);
public:
    static GlutApplication* instance();
    int exec();
    void setActiveWindow(AbstractGlutWindow*);
    AbstractGlutWindow* activeWindow();
protected:
    GlutApplication();
    virtual void onDisplay();
    virtual void onReshape(int, int);
    virtual void onVisibility(int);
    virtual void onKeyboard(unsigned char, int, int);
private:
    void init();

private:
    static GlutApplication* pApp;
    AbstractGlutWindow* pActiveWindow;
};


